<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2018/7/21
 * Time: 下午2:39
 */
namespace PddWechat\Models\Sms\Service;

use Dai\Framework\Base\BaseException;
use Dai\Framework\Base\BaseService;
use PddWechat\Library\SmsLibrary;

class SmsCode extends BaseService {

    public function execute($basePageInfo) {
        /** @var \PddWechat\Models\Sms\Param\SmsCodeParam $params */
        $params = $basePageInfo->params;
        $phone = $params->phone;
        $sms = new SmsLibrary();
        $code = $sms->makeCode();
        $serial = $sms->makeSerialNumber();
        $sms->sendSms($phone, $code, $serial);
        return true;
    }
}